#ifndef MTK_TV_H
#define MTK_TV_H

#include <QString>
#include <QMap>
#include <QMessageBox>

#ifndef DATA_STRUCT_H
#define DATA_STRUCT_H
#include "data_struct.h"
#endif

class MTK_TV
{
    friend class translate;
public:
    MTK_TV();
    ~MTK_TV();
    QList<MTK_ATV_DATA*> mtk_atv;
    QList<MTK_DTV_DATA*> mtk_dtv;
private:
     //This record the current dtv numbers
     uint count_dtv;
     QString file_name;
     //This record the original dtv numbers which in tv file.
     //They will be used in Write_DTV_BIN()when datas,edited，write to tv files.
     uint old_count_dtv;
     uint old_count_atv;
     uint count_atv;
     uint empty;//record the open tv files times.if(times>1) I let clear datas.

     BIN_FILE_HEADER header;

 public:
    int Read_BIN(FILE *fp,int start,int end,bool is_class);
    int Read_File(const char *);
    int Write_BIN(FILE*fp,int num,bool is_class);
    int Write_File(const char *);



    void Mod_ATV(int row,int col,QString );
    void Mod_DTV(int row,int col,QString value);

    void Get_Chan_Num(QList<uint> *atv_Num,QMap<uint,uchar>* dtv_air_Num);
    void Del_ATV_Row(int row);
    void Del_DTV_Row(int row);

    uint Get_ATV_Num(int row);
    uint Get_DTV_Num(int row);

    uint Get_ATV_Count();
    uint Get_DTV_Count();

    bool Is_Empty();
    void Clear();
    void Clear_Data();
    void Empty_Add_One();
    void Empty_Dul_One();
    void set_Empty(uint);

    void Add_DTV_CH(QList<QString>);
    void Add_ATV_CH(QList<QString>);
    void Sort_ATV();
    void Sort_DTV();

};

#endif // MTK_TV_H
